package com.legrand.core.util;


import com.legrand.core.exception.ExceptionBase;

/**
 * @author xiah
 * @date 2018/5/2 18:27
 */
public class TokenUtil {
    /**
     * @author xiah
     * description: 该方法用来截取token
     * param:
     * return:
     * date: 2018/5/2
     */
    public static String interceptToken(String token) {
        if (token == null || token.length() < 7 || (!token.toLowerCase().startsWith("barear "))
                ) {
            /*抛出token错误异常，后期处理*/
            throw new ExceptionBase(122, "phoneNumber is wrong");
        }
        String to = token.substring(7);
        return to;
    }

    public static String getUser(String token) {
        return "";
    }

}
